package ext.tianma.masschange.picker;

import java.io.IOException;
import java.util.Locale;

import wt.session.SessionHelper;
import wt.util.WTException;
import wt.util.WTMessage;
import wt.util.WTProperties;

import com.ptc.jca.mvc.components.AbstractItemPickerConfig;
import com.ptc.netmarkets.util.beans.NmCommandBean;

import ext.tianma.masschange.datautility.MassChangeCheckListDataUtility;

public class CustAddPartPickerConfig extends AbstractItemPickerConfig{
	private static String RESOURCE = "ext.tianma.masschange.resource.MassChangeResource";
	private static String CLASSNAME="";
	private static boolean VERBOSE = false;
	private static WTProperties wtProperties;
	private static Locale locale = null;
	private static String PickerTitle=null;

	static {

		try {
			CLASSNAME= MassChangeCheckListDataUtility.class.getName();
			wtProperties = WTProperties.getLocalProperties();
			locale = SessionHelper.manager.getLocale();
			VERBOSE = wtProperties.getProperty("ext.tianma.masschange.picker.verbose", false);
		}
		catch (IOException ioe) {
			ioe.printStackTrace();
		}catch (Throwable throwable) {
			throw new ExceptionInInitializerError(throwable);
		}
	}
	
	public CustAddPartPickerConfig() {

	}
	  /**
	 *输出调试信息
	 */
	private static void outDebugInfo(String info) {
		if(VERBOSE)
			System.out.println(CLASSNAME+"......"+info);
	}
	
	public String getPickerId() {
	    return "resultingItemsPicker";
	}
	
	public String getDefaultVersionValue(NmCommandBean paramNmCommandBean) {
	    return "LATEST";
	}
	
	public String getSingleSelectTypePicker(NmCommandBean paramNmCommandBean) {
	    return Boolean.FALSE.toString();
	}
	
	protected String getPickerTitleName() {
	    return "FIND_AFFECTED_DATA";
	}
	
	public String getPickerTitle(NmCommandBean paramNmCommandBean) throws WTException {
	    String pickerTitle = WTMessage.getLocalizedMessage(RESOURCE, "ADD_USEAGE_LINK", null, SessionHelper.getLocale());
	    return pickerTitle;
	}
	
	public String getMultiSelect(NmCommandBean paramNmCommandBean) throws WTException {
	    return Boolean.TRUE.toString();
	}
	
	public String getInline(NmCommandBean paramNmCommandBean) throws WTException {
	    return Boolean.TRUE.toString();
	}
	
	public String getCustomAccessController(NmCommandBean paramNmCommandBean) throws WTException {
	    return "com.ptc.windchill.enterprise.search.server.accesscontrollers.newobject.NewObjectAccessController";
	}
	
	public String getObjectType(NmCommandBean paramNmCommandBean) throws WTException {
		return "wt.part.WTPart";
	}
	
	public String getComponentId(NmCommandBean paramNmCommandBean) throws WTException {
		return "variantPickerSearch";
	}
	
	public String getExcludeSubTypes(NmCommandBean paramNmCommandBean) throws WTException {
		return "WCTYPE|wt.doc.WTDocument,WCTYPE|wt.epm.EPMDocument,WCTYPE|com.ptc.windchill.enterprise.requirement.Specification,WCTYPE|com.ptc.windchill.enterprise.requirement.Requirement";
	}
	
	
	/*public String getBaseWhereClause(NmCommandBean paramNmCommandBean)throws WTException {
		StringBuilder localStringBuilder = new StringBuilder();
		localStringBuilder.append("(").append("endItem='false')");
		String str = localStringBuilder.toString();
		return "((COALESCE(checkoutInfo.state,'')!='wrk')&(COALESCE(checkoutInfo.state,'')!='sb c/o')&(COALESCE(latestIteration,'')='1'))";
		//return "((COALESCE(checkoutInfo.state,'')!='wrk')&(COALESCE(checkoutInfo.state,'')!='sb c/o'))";
		//return str;
	}*/
	
	
	public String getPickerCallback() throws WTException {  
	    return "AddSelectPartPickerCallback";
	}

}
